Display as much of the raw diff as possible while staying within GitHub's comment character limit#25
Merged
AlexWaygood merged 3 commits intomainfrom Mar 23, 2026
Conversation
…PR diff display Instead of truncating the raw diff to a hardcoded 100 entries, compute a character budget based on GitHub's 65,536-character comment limit minus the space already used by the rest of the comment. The sampling logic now greedily fills the budget with randomly-shuffled entries, displaying as many changes as will fit. The old --max-raw-diff-lines flag is preserved (default None) for backward compatibility but is no longer needed in the common case. https://claude.ai/code/session_01AQNDHAwavNHvBNnCQKAkx3
sharkdp
reviewed
Mar 23, 2026
sharkdp
reviewed
Mar 23, 2026
sharkdp
approved these changes
Mar 23, 2026
sharkdp
approved these changes
Mar 23, 2026
Member
Author
|
tested in astral-sh/ruff#24136 -- it looks good: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Since we anyway collapse the raw diff if it grows too large, I'd prefer to be able to see the full diff in the PR comment if it will fit within GitHub's character comment limit. This PR implements that. The line-count-based sampling strategy is replaced with character-budget-based sampling that:
max_raw_diff_lineslimit if explicitly provided